﻿using System;
using System.Collections.Generic;
using System.ComponentModel.Design;
using System.IO;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading.Tasks;
using Tnelab.Common;

namespace Tnelab.Miniblink
{
    public static class WebViewFactory
    {
        public static IWebView Create(IntPtr parentHandle)
        {
            var isX64 = IntPtr.Size==8;
            string mbPath = @"runtimes\win-x86\native\mb.dll";
            if (isX64)
            {
                mbPath = @"runtimes\win-x64\native\mb.dll";
            }
            if (File.Exists("mb.dll"))
            {
                mbPath = "mb.dll";
            }
            if (File.Exists(mbPath))
            {
                return new VipWebView(parentHandle);
            }
            return new WkeWebView(parentHandle);
        }
    }
}
